package com.wuye.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.wuye.VO.YiBiaoTypeVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wuye.common.annotation.Log;
import com.wuye.common.core.controller.BaseController;
import com.wuye.common.core.domain.AjaxResult;
import com.wuye.common.enums.BusinessType;
import com.wuye.domain.WyYbType;
import com.wuye.service.IWyYbTypeService;
import com.wuye.common.utils.poi.ExcelUtil;
import com.wuye.common.core.page.TableDataInfo;

/**
 * 仪类类型Controller
 * 
 * @author jack
 * @date 2024-11-22
 */
@RestController
@RequestMapping("/yibiaoManagement/yibiaoType")
public class WyYbTypeController extends BaseController
{
    @Autowired
    private IWyYbTypeService wyYbTypeService;

//    /**
//     * 查询仪类类型列表
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:list')")
//    @GetMapping("/list")
//    public TableDataInfo list(WyYbType wyYbType)
//    {
//        startPage();
//        List<WyYbType> list = wyYbTypeService.selectWyYbTypeList(wyYbType);
//        return getDataTable(list);
//    }



//    /**
//     * 导出仪类类型列表
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:export')")
//    @Log(title = "仪类类型", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, WyYbType wyYbType)
//    {
//        List<WyYbType> list = wyYbTypeService.selectWyYbTypeList(wyYbType);
//        ExcelUtil<WyYbType> util = new ExcelUtil<WyYbType>(WyYbType.class);
//        util.exportExcel(response, list, "仪类类型数据");
//    }
//
//    /**
//     * 获取仪类类型详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:query')")
//    @GetMapping(value = "/{ybTpId}")
//    public AjaxResult getInfo(@PathVariable("ybTpId") Long ybTpId)
//    {
//        return success(wyYbTypeService.selectWyYbTypeByYbTpId(ybTpId));
//    }
//
//    /**
//     * 新增仪类类型
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:add')")
//    @Log(title = "仪类类型", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody WyYbType wyYbType)
//    {
//        return toAjax(wyYbTypeService.insertWyYbType(wyYbType));
//    }
//
//    /**
//     * 修改仪类类型
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:edit')")
//    @Log(title = "仪类类型", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody WyYbType wyYbType)
//    {
//        return toAjax(wyYbTypeService.updateWyYbType(wyYbType));
//    }
//
//    /**
//     * 删除仪类类型
//     */
//    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:remove')")
//    @Log(title = "仪类类型", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ybTpIds}")
//    public AjaxResult remove(@PathVariable Long[] ybTpIds)
//    {
//        return toAjax(wyYbTypeService.deleteWyYbTypeByYbTpIds(ybTpIds));
//    }


    /**
     * 导出仪类类型列表
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:export')")
    @Log(title = "仪类类型", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WyYbType wyYbType)
    {
        List<WyYbType> list = wyYbTypeService.selectWyYbTypeList(wyYbType);
        ExcelUtil<WyYbType> util = new ExcelUtil<WyYbType>(WyYbType.class);
        util.exportExcel(response, list, "仪类类型数据");
    }


    /**
     * 仪表类型列表
     * @param wyYbType
     * @return
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:list')")
    @GetMapping("/list")
    public TableDataInfo list( WyYbType wyYbType)
    {
        startPage();
        List<YiBiaoTypeVo> yiBiaoTypeVos = wyYbTypeService.selectWyYbTypeList2(wyYbType);
        return getDataTable(yiBiaoTypeVos);
    }


    /**
     * 获取仪类类型详细信息
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:query')")
    @GetMapping(value = "/{ybTpId}")
    public AjaxResult getInfo(@PathVariable("ybTpId") Long ybTpId)
    {
        return success(wyYbTypeService.selectWyYbTypeByYbTpId(ybTpId));
    }

    /**
     * 新增仪类类型
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:add')")
    @Log(title = "仪类类型", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WyYbType wyYbType)
    {
        return toAjax(wyYbTypeService.insertWyYbType(wyYbType));
    }


    /**
     * 修改仪类类型
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:edit')")
    @Log(title = "仪类类型", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WyYbType wyYbType)
    {
        return toAjax(wyYbTypeService.updateWyYbType(wyYbType));
    }

    /**
     * 删除仪类类型
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:remove')")
    @Log(title = "仪类类型", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ybTpIds}")
    public AjaxResult remove(@PathVariable Long[] ybTpIds)
    {
        return toAjax(wyYbTypeService.deleteWyYbTypeByYbTpIds(ybTpIds));
    }


    /**
     * 仪表类型列表
     * @return
     */
    @PreAuthorize("@ss.hasPermi('yibiaoManagement:yibiaoType:list')")
    @GetMapping("/shoufei")
    public TableDataInfo shoufei()
    {
        return getDataTable(wyYbTypeService.shoufei());
    }
}
